﻿using System.Windows;
using WpfApp_NotifyPropertyChanged.Commands;

namespace WpfApp_NotifyPropertyChanged.ViewModels
{
    public class MainViewModel : ViewModelBase
    {
        public MyCommand ShowCommand { get; set; }

        public string _message;

        public string Message
        {
            get => _message;
            set
            {
                _message = value;
                OnPropertyChanged();
            }
        }

        public MainViewModel()
        {
            ShowCommand = new MyCommand(ShowMessage);
            Message = "Hello";
        }

        public void ShowMessage()
        {

            this.Message = "我被点击了!!!";
            MessageBox.Show(Message);
        }
    }
}